home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / exkey4.arc / TPTEST.PAS < prev   
Pascal/Delphi Source File  |  1990-01-27  |  2KB  |  96 lines

  1. PROGRAM TPTest;
  2.  
  3. { Simple test program for ExKey unit, INT 16 keyboard handler. The routine
  4.   should display the name of any function key as you press it, including
  5.   the F11 and F12 keys which are NOT supported by the default routine. If this
  6.   program does NOT run properly on your machine, it probably means that your
  7.   BIOS is not able to handle an extended AT/PS2 style keyboard. Any
  8.   questions about this program may be addressed to the author:
  9.  
  10.     Aubrey Scoon
  11.     Scoon Consultancy Services
  12.     49 Honeyhill Road,
  13.     Bracknell,
  14.     Berkshire.
  15.     RG12 1YH
  16.     U.K.
  17.  
  18.    Alternatively leave a message to me on Hawk's Castle BBS (0344) 411621 or
  19.    Mission Impossible BBS (0602) 654329 (both 24 hour 300,1200,2400,9600HST,
  20.    8 bits, No parity, 1 Stopbit)
  21. }
  22.  
  23. USES
  24.  
  25.     CRT,ExKey;
  26.  
  27. VAR
  28.  
  29.     ch: char;
  30.  
  31. BEGIN
  32.  
  33.     SetKeyVector;  { Install new INT 16 keyboard handler }
  34.  
  35.         ClrScr;
  36.     
  37.     IF (Ext_Keyboard_Present=TRUE) THEN
  38.          Writeln('101/102 key keyboard detected');
  39.  
  40.     Writeln;
  41.  
  42.     Writeln('Press ESC at any time to exit');
  43.     Writeln;
  44.  
  45.     ch:=#255;    { Dummy value to fool "while" routine }
  46.  
  47.     WHILE (ch<>#27) DO   { check for escape }
  48.  
  49.     BEGIN
  50.  
  51.         ch:=Readkey;
  52.  
  53.         IF (ch<>#0) THEN
  54.  
  55.         BEGIN
  56.  
  57.              IF (ch<>#27) THEN Writeln('That was not a function key');
  58.  
  59.         END
  60.  
  61.         ELSE
  62.  
  63.         BEGIN
  64.  
  65.              Write('You have pressed ');
  66.              ch:=Readkey;
  67.  
  68.              CASE ch OF
  69.  
  70.             #59: Writeln('F1');
  71.             #60: Writeln('F2');
  72.             #61: Writeln('F3');
  73.             #62: Writeln('F4');
  74.             #63: Writeln('F5');
  75.             #64: Writeln('F6');
  76.             #65: Writeln('F7');
  77.             #66: Writeln('F8');
  78.             #67: Writeln('F9');
  79.             #68: Writeln('F10');
  80.             #133: Writeln('F11');
  81.             #134: Writeln('F12');
  82.  
  83.                  ELSE
  84.  
  85.             Writeln('a special key or combination of keys');
  86.  
  87.              END; { CASE }
  88.  
  89.         END; { IF }
  90.  
  91.     END; { WHILE }
  92.  
  93.     RestoreKeyVector;  { restore default INT 16 handler }
  94.  
  95. END.
  96.